<template>
  <el-dialog
    class="dialog"
    :visible="_visible"
    :title="$t('warnTitle')"
    :append-to-body="true"
    width="600px"
    :before-close="handleClose"
  >
    <div class="snapDetail-body d-flex jc-center ai-center">
      <div class="left d-flex jc-center ai-center">
        <MyImage class="img-box" :src="row.snap_path" />
      </div>
      <div class="right d-flex flex-1 flex-column jc-center ai-center">
        <div class="d-flex jc-between ai-center mb-20">
          <span>{{ $t("warnType") }}</span>
          <span>{{
            (row.events_type || row.alarm_type) | formatEventsType
          }}</span>
        </div>
        <div class="d-flex jc-between ai-center mb-20">
          <span>{{ $t("channelName") }}</span>
          <span>{{ row.camera_name }}</span>
        </div>
        <div class="d-flex jc-between ai-center">
          <span>{{ $t("warnTime") }}</span>
          <span>{{ row.trigger_time }}</span>
        </div>
      </div>
    </div>
  </el-dialog>
</template>
<script>
import MyImage from "@/components/Image.vue";
export default {
  components: {
    MyImage,
  },
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    row: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      isAddrShow: true,
      isIdShow: true,
    };
  },
  computed: {
    _visible: {
      get() {
        return this.visible;
      },
      set(val) {
        this.$emit("update:visible", val);
      },
    },
  },
  methods: {
    handleClose(done) {
      this._visible = false;
      done();
    },
    getEncryptInfo(res, key, isShowKey) {
      if (res.data.record.length) {
        this.$set(this.record, key, res.data.record[0][key]);
      } else {
        this.$message.warning(this.$t("emptyData"));
      }
      this[isShowKey] = false;
    },
  },
};
</script>
<style lang="less" scoped>
.dialog {
  z-index: 9999;
  .snapDetail-body {
    width: 100%;
    height: 270px;
    display: flex;
    justify-content: center;
    align-items: center;
    .left {
      height: 100%;
      .img-box {
        border: 1px solid #e6edf2;
      }
    }
    .right {
      height: 100%;
      flex: 1;
      .title {
        width: 100px;
        border-radius: 5px;
        background: #ccc;
        margin: 0 auto;
        text-align: center;
      }
      div {
        line-height: 20px;
        span:first-child {
          display: inline-block;
          width: 100px;
        }
        span:second-child {
          display: inline-block;
          width: 150px;
        }
      }
      .snap-info {
        height: 100%;
      }
      .lib_info {
        height: 100%;
      }
    }
  }
}
</style>
